Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: ganache migration base setup #27246

Draft
wants to merge 52 commits into
base: main
Choose a base branch
from
Draft

Conversation

seaona
Copy link
Contributor

@seaona seaona commented Sep 18, 2024

Description

Ganache Migration Phase:

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3321

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Copy link
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Copy link

socket-security bot commented Sep 18, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@isaacs/fs-minipass@4.0.1 filesystem 0 101 kB isaacs
npm/@types/unzipper@0.10.10 None 0 6.16 kB types
npm/@viem/anvil@0.0.10 network Transitive: environment +9 367 kB jmoxey
npm/abitype@1.0.5 None 0 1.17 MB awkweb
npm/get-port@6.1.2 None 0 11.1 kB sindresorhus
npm/isows@1.0.4 None 0 10.2 kB jmoxey
npm/unzipper@0.12.3 filesystem 0 56.6 kB zjonsson
npm/viem@2.21.8 None +4 15.8 MB awkweb, jmoxey
npm/webauthn-p256@0.0.5 None 0 187 kB jmoxey

View full report↗︎

Copy link

socket-security bot commented Sep 18, 2024

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Network access npm/@viem/anvil@0.0.10 🚫
Network access npm/@viem/anvil@0.0.10 🚫

View full report↗︎

Next steps

What is network access?

This module accesses the network.

Packages should remove all network access that is functionally unnecessary. Consumers should audit network access to ensure legitimate use.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/foo@1.0.0 or ignore all packages with @SocketSecurity ignore-all

  • @SocketSecurity ignore npm/@viem/anvil@0.0.10

@seaona seaona self-assigned this Sep 18, 2024
Copy link

sonarcloud bot commented Sep 18, 2024

Copy link

codecov bot commented Sep 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.02%. Comparing base (3e5c0a8) to head (38b4b80).
Report is 17 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #27246      +/-   ##
===========================================
+ Coverage    70.00%   70.02%   +0.02%     
===========================================
  Files         1445     1443       -2     
  Lines        50195    50165      -30     
  Branches     14041    14041              
===========================================
- Hits         35139    35127      -12     
+ Misses       15056    15038      -18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@metamaskbot
Copy link
Collaborator

Builds ready [38b4b80]
Page Load Metrics (1636 ± 45 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1501184916369545
domContentLoaded1491179616159043
load1501184716369445
domInteractive196834157
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 5.26 KiB (0.15%)
  • ui: 0 Bytes (0.00%)
  • common: 56.95 KiB (0.71%)

@@ -1,4 +1,4 @@
import GanacheContractAddressRegistry from '../seeder/ganache-contract-address-registry';
import ContractAddressRegistry from '../seeder/contract-address-registry';
Copy link
Contributor Author

@seaona seaona Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a rename, as now it's used both with ganache and anvil - no functionality change

*/
class GanacheContractAddressRegistry {
class ContractAddressRegistry {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a rename, as now it's used both with ganache and anvil - no functionality change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change already merged on a separate PR, to make this one smaller

@@ -3,14 +3,14 @@ const { ContractFactory, Contract } = require('@ethersproject/contracts');

const { ENTRYPOINT, GANACHE_ACCOUNT } = require('../constants');
const { SMART_CONTRACTS, contractConfiguration } = require('./smart-contracts');
const GanacheContractAddressRegistry = require('./ganache-contract-address-registry');
const ContractAddressRegistry = require('./contract-address-registry');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a rename, as now it's used both with ganache and anvil - no functionality change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change already merged on a separate PR, to make this one smaller


return { publicClient, testClient, walletClient };
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file will be expanded in the future, for when we want to add Optimism clients for L2 network support. See:

https://www.opviem.sh/

@@ -0,0 +1,149 @@
const { DEFAULT_FIXTURE_ACCOUNT, ENTRYPOINT } = require('../constants');
Copy link
Contributor Author

@seaona seaona Sep 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file supports the same functionality as ganache seeder, but adapted to viem (meaning using publicClient/walletClient/testClient for the different actions), so we are able to expand to L2's in the future with L2 clients

mnemonic:
'spread raise short crane omit tent fringe mandate neglect detail suspect cradle',
port: 8545,
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This are the default network options. Since we have them defined here, there's no need for defaultAnvilOptions, so we don't need to pass anything in the spec files, when we want the default options (see spec files above).

Likewise, we have ganache options defined in the ganache file, we wouldn't need the defaultGanacheOptions (but it's implemented like this)

await this.#server.stop();
} catch (e) {
console.log('Caught error while closing Anvil network:', e);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are the same methods that we support on ganache, so functionality is preserved

@seaona seaona added the area-qa Relating to QA work (Quality Assurance) label Nov 25, 2024
@metamaskbot
Copy link
Collaborator

Builds ready [27e4895]
Page Load Metrics (1978 ± 69 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint16672326198815977
domContentLoaded16172236192414368
load16702256197814469
domInteractive176634136
backgroundConnect1196512713
firstReactRender653961286833
getState591232512
initialActions01000
loadScripts11461625140412459
setupStore694202411
uiStartup182228202234230111
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -320 Bytes (-0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [66c17fb]
Page Load Metrics (1992 ± 107 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint175327251999231111
domContentLoaded170126191950212102
load175226681992223107
domInteractive19201413919
backgroundConnect15113482713
firstReactRender852941284321
getState57020209
initialActions01000
loadScripts12352014144018086
setupStore65912115
uiStartup192829702243272131
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -320 Bytes (-0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [ac507d6]
Page Load Metrics (1795 ± 105 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint32521681695349168
domContentLoaded153224501756214103
load154424561795218105
domInteractive257541168
backgroundConnect1295382512
firstReactRender1696382612
getState55616157
initialActions01000
loadScripts11311945131218890
setupStore65612136
uiStartup173027262005236113
Bundle size diffs [🚀 Bundle size reduced!]
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: -320 Bytes (-0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-qa Relating to QA work (Quality Assurance) team-extension-platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants